<?php

namespace common\models\ar;

use Yii;

/**
 * This is the model class for table "money_withdraw".
 *
 * @property int $id
 * @property string $withdraw_sn 提现编号
 * @property int $userID 用户ID
 * @property int $direction 操作方向，见money_change_direction表
 * @property string $money 劣后出金金额
 * @property int $status 0末处理，1请求中，2接口处理失败，3接口处理成功，4后台拒绝，5用户取消
 * @property string $resp_code 代付状态码
 * @property int $withdraw_open_time 提交时间
 * @property int $withdraw_start_time 正式处理时间
 * @property int $withdraw_end_time 完成时间
 * @property string $data_request 向第三方支付公司提交的请求数据
 * @property string $data_response 调用代付接口返回的信息
 * @property int $uid_admin 如果是平台操作，记录平台ID
 * @property string $admin_remark 管理员操作备注
 * @property string $loginName
 */
class MoneyWithdraw extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'money_withdraw';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['userID', 'withdraw_open_time', 'withdraw_start_time', 'withdraw_end_time', 'uid_admin'], 'integer'],
            [['money'], 'number'],
            [['data_request', 'data_response', 'admin_remark'], 'string'],
            [['loginName'], 'required'],
            [['withdraw_sn'], 'string', 'max' => 32],
            [['direction', 'status'], 'string', 'max' => 4],
            [['resp_code'], 'string', 'max' => 16],
            [['loginName'], 'string', 'max' => 40],
            [['withdraw_sn'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'withdraw_sn' => 'Withdraw Sn',
            'userID' => 'User ID',
            'direction' => 'Direction',
            'money' => 'Money',
            'status' => 'Status',
            'resp_code' => 'Resp Code',
            'withdraw_open_time' => 'Withdraw Open Time',
            'withdraw_start_time' => 'Withdraw Start Time',
            'withdraw_end_time' => 'Withdraw End Time',
            'data_request' => 'Data Request',
            'data_response' => 'Data Response',
            'uid_admin' => 'Uid Admin',
            'admin_remark' => 'Admin Remark',
            'loginName' => 'Login Name',
        ];
    }
}
